<?php
/**
 * @license    GNU/GPL
 */

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the CommunalMeals Component
 *
 */

class CommunalMealsViewEditEvent extends JView
{
	function display($tpl = null)
	{
		global $option, $mainframe;
		
		// Get ids from request
		$groupId = JRequest::getVar('group_id', NULL );
		$eventId = JRequest::getVar('event_id', NULL );
		
		// Get data from model
		$event = CMeals::readEvent($eventId, $groupId);
		$eventGroup = CMeals::readEventGroup($groupId);
		
		// Pass data to template
		$this->assignRef( 'event', $event );
		$this->assignRef( 'eventGroup', $eventGroup );
		$this->assignRef( 'option', $option );
		
        // Select appropriate subtemplate for event type
        $tpl = strtolower($event->type);
        
		parent::display($tpl);
	}
}